import React, { Component } from 'react'
import { getCodeImg } from '@/api/login'
import style from './index.module.scss'
import imgBg1 from '@/assets/images/loginBk1.png'
import imgBg2 from '@/assets/images/loginBk2.png'
import logo from '@/assets/images/metro.png'
import logoBg from '@/assets/images/metro2.png'
export default class index extends Component {
	state = {
		codeUrl:""
	}

	componentDidMount(){
		this.getImg()
	}

	getImg = async ()=>{
		let res = await getCodeImg()
		this.setState({
			codeUrl:"data:image/gif;base64," + res.img
		})
		console.log(this.state.codeUrl);
	}

	goLogin = async ()=>{
		// let res = await getCodeImg()
		// console.log(res);
	}
	
	render() {
		return (
			<div className={style.loginBg}>
				<img className={style.bgimg1} src={imgBg1} alt="" />
				<img className={style.bgimg2} src={imgBg2} alt="" />
				<div className={style.mainBox}>
					<div className={style.leftBox}>
						<img className={style.leftBoxImg1} src={logo} alt="" />
						<img className={style.leftBoxImg2} src={logoBg} alt="" />
					</div>
					<div className={style.rightBox}>
						<h1>欢迎登陆</h1>
						<div className={style.tips}>使用账户密码登陆</div>
						{/* <img src={this.state.codeUrl} alt="" /> */}
						<button onClick={this.goLogin}> 登录</button>
					</div>
				
				</div>
				
			</div>
		)
	}
}
